package vn.axonactive;

import java.util.List;

import javax.enterprise.context.RequestScoped;
import javax.faces.event.ActionEvent;
import javax.inject.Inject;
import javax.inject.Named;

@Named
@RequestScoped
public class BookManagement {
	private List<Book> books;
	private String name;

	@Inject
	BookService bookService;

	public void saveBook(ActionEvent event) {
		Book book = new Book();
		book.setBookName(name);
		bookService.saveBook(book);
	}

	public List<Book> getBooks() {
		books = bookService.getBooks();
		return books;
	}

	public void setBooks(List<Book> books) {
		this.books = books;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
